package annotations.xml;


import javax.xml.bind.JAXBContext;
import javax.xml.bind.JAXBException;
import javax.xml.bind.Unmarshaller;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;
import java.io.File;

/**
 * Created by IntelliJ IDEA.
 * User: Admin
 * Date: 11.05.2011
 * Time: 21:31:01
 * To change this template use File | Settings | File Templates.
 */
@XmlRootElement(name = "root")
@XmlAccessorType(value = XmlAccessType.NONE)
public class RootClass {

    @XmlElement(required = true, defaultValue = "empty")
    private String name;

    @XmlElement(name = "secondname")
    private String modifier;

    @XmlElement(name="content")
    private Content parsed_content;



    private String session_key;

    @Override
    public String toString() {
        return "RootClass{" +
                "name='" + name + '\'' +
                ", modifier='" + modifier + '\'' +
                ", parsed_content=" + parsed_content +
                ", session_key='" + session_key + '\'' +
                '}';
    }

    public static void main(String ... args) throws JAXBException {

        JAXBContext context = JAXBContext.newInstance(RootClass.class);
        Unmarshaller unmarshaller = context.createUnmarshaller();
        RootClass report_manager = (RootClass) unmarshaller.unmarshal(new File("conf/conf.xml"));

        System.out.println("Parsed xml content");
        System.out.println(report_manager);

    }
}
